#!/bin/bash

# ----------------------------------------------------------------------
# Filename:   75557-rpm.sh
# Version:    1.0
# Date:       2013/12/02
# Author:     yuanhui.shi
# Email:      yuanhui.shi@cs2c.com.cn
# Summary:    02系统基本功能-07开发环境-02开发工具-02rpm构建工具-01查询软件包是否已经安装
# Notes:      rpm命令
# Copyright:  China Standard Software Co., Ltd.
# History：     
#             Version 1.0, 2013/12/02
#             -   The first one
# ----------------------------------------------------------------------

PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH

source ../../lib/Echo.sh

source ../../lib/XmlParse.sh


function CleanData ()
{
  EchoInfo "75557-rpm.sh执行完毕"
}

trap "CleanData" EXIT INT

#查询一个软件包的安装情况，例如gcc
EchoInfo "查询一个软件包的安装情况，例如gcc"
rpm -q gcc
EchoResult "系统安装了gcc软件包"

#查询多个软件包的安装情况
EchoInfo "查询多个软件包的安装情况"
rpm -q gcc glibc glibc-devel|grep 'gcc'
EchoResult "系统安装了gcc软件包"
rpm -q glibc glibc-devel|grep 'glibc'
EchoResult "系统安装了glibc软件包"
rpm -q glibc glibc-devel|grep 'glibc-devel'
EchoResult "系统安装了glibc-devel软件包"

#查询一个虚构软件包的安装情况
EchoInfo "查询一个虚构软件包的安装情况"
! rpm -q syh
EchoResult "虚构的软件包不存在"
